import http from '/@/utils/http';

/**
 * 设备资产管理api接口集合
 * @method getDeviceModelList 获取设备型号下拉框列表
 * @method addDeviceModelApi 添加设备型号
 * @method addPurveyor 添加供应厂家
 * @method editPurveyor 编辑供应厂家
 * @method deletePurveyor 删除供应厂家
 * @method getPurveyorList 获取供应商下拉
 * @method addDeviceApi 新增设备
 * @method deviceDetailApi 设备详情
 * @method updateStopFlagApi 设备停用/启用
 * @method deleteDeviceApi 删除设备
 * @method editDeviceApi 编辑设备
 * @method partRelevanceApi 备件关联
 * @method removeRelevanceApi 删除关联
 * @method downloadMouldApi 下载设备导入模板
 * @method importDeviceApi 导入设备
 * @method deviceQrCodeBatchReportApi 批量导出设备二维码
 * @method deviceQrCodeReportApi 单个导出设备二维码
 */

export const getDeviceModelList = async (deviceType: any) => {
  return await http.get(`/device/mobile/deviceModel/getDeviceModelList/${deviceType}`)
}

export const addPurveyor = async (params: any) => {
  return await http.post(`/device/mobile/devicePurveyor/addPurveyor`, params)
}

export const editPurveyor = async (params: any) => {
  return await http.put(`/device/mobile/devicePurveyor/editPurveyor`, params)
}

export const deletePurveyor = async (params: any) => {
  return await http.delete(`/device/mobile/devicePurveyor/deletePurveyor/${params}`)
}

export const getPurveyorList = async () => {
  return await http.get(`/device/mobile/devicePurveyor/getPurveyorList`)
}

export const addDeviceModelApi = async (params: any) => {
  return await http.post(`/device/mobile/deviceModel/addDeviceModel`, params)
}

export const addDeviceApi = async (params: any) => {
  return await http.post(`/device/mobile/deviceInfo/addDevice`, params)
}

export const deviceDetailApi = async (deviceId: any) => {
  return await http.get(`/device/mobile/deviceInfo/deviceDetail/${deviceId}`)
}

export const updateStopFlagApi = async (deviceId: any) => {
  return await http.put(`/device/mobile/deviceInfo/updateStopFlag/${deviceId}`)
}

export const deleteDeviceApi = async (deviceId: any) => {
  return await http.delete(`/device/mobile/deviceInfo/deleteDevice/${deviceId}`)
}

export const editDeviceApi = async (params: any) => {
  return await http.put(`/device/mobile/deviceInfo/editDevice`, params)
}

export const partRelevanceApi = async (deviceType: any, params: any) => {
  return await http.post(`/device/mobile/devicePartRelevance/partRelevance/${deviceType}`, params)
}

export const removeRelevanceApi = async (id: any) => {
  return await http.delete(`/device/mobile/devicePartRelevance/removeRelevance/${id}`)
}

export const downloadMouldApi = async () => {
  return await http.postBlob(`/device/mobile/deviceInfo/downloadMould`)
}

export const importDeviceApi = async (params: any) => {
  return await http.postUpload(`/device/mobile/deviceInfo/importDevice`, params)
}

export const deviceQrCodeBatchReportApi = async (params: any) => {
  return await http.post(`/device/mobile/deviceInfo/deviceQrCodeBatchReport`, params)
}

export const deviceQrCodeReportApi = async (params: any) => {
  return await http.postBlob(`/device/mobile/deviceInfo/deviceQrCodeReport`, params)
}